From: Rob Church Date: Mon, 6 Aug 2007 07:09:59 +0000 (+0000) Subject: * (bug 10655) Show standard tool links for blocked users in block log messages X-Git-Tag: 1.31.0-rc.0~51863 X-Git-Url: http://git.cyclocoop.org/%28%5B%5E/404?a=commitdiff_plain;h=84106fe957b802c895132eb2af209409384819fa;p=lhc%2Fweb%2Fwiklou.git * (bug 10655) Show standard tool links for blocked users in block log messages * Show standard tool links for blocked users in Special:Ipblocklist The above exclude the block link (where applicable) using the first of the flags to be passed to Linker::userToolLinks(). --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index bbf584b714..fa683a2ae7 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -359,6 +359,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 10765) img_auth.php will now refuse logged-out requests where $wgWhitelistRead is undefined, instead of (incorrectly) honouring them * Fixed img_auth.php file name extraction for whitelist checking +* (bug 10655) Show standard tool links for blocked users in block log messages +* Show standard tool links for blocked users in Special:Ipblocklist == API changes since 1.10 == diff --git a/includes/Linker.php b/includes/Linker.php index 56377fa2fb..f6bcf7f9a8 100644 --- a/includes/Linker.php +++ b/includes/Linker.php @@ -12,6 +12,12 @@ * @addtogroup Skins */ class Linker { + + /** + * Flags for userToolLinks() + */ + const TOOL_LINKS_NOBLOCK = 1; + function __construct() {} /** @@ -744,15 +750,18 @@ class Linker { } /** - * @param $userId Integer: user id in database. - * @param $userText String: user name in database. - * @param $redContribsWhenNoEdits Bool: return a red contribs link when the user had no edits and this is true. - * @return string HTML fragment with talk and/or block links + * Generate standard user tool links (talk, contributions, block link, etc.) + * + * @param int $userId User identifier + * @param string $userText User name or IP address + * @param bool $redContribsWhenNoEdits Should the contributions link be red if the user has no edits? + * @param int $flags Customisation flags (e.g. self::TOOL_LINKS_NOBLOCK) + * @return string */ - public function userToolLinks( $userId, $userText, $redContribsWhenNoEdits = false ) { + public function userToolLinks( $userId, $userText, $redContribsWhenNoEdits = false, $flags = 0 ) { global $wgUser, $wgDisableAnonTalk, $wgSysopUserBans; $talkable = !( $wgDisableAnonTalk && 0 == $userId ); - $blockable = ( $wgSysopUserBans || 0 == $userId ); + $blockable = ( $wgSysopUserBans || 0 == $userId ) && !$flags & self::TOOL_LINKS_NOBLOCK; $items = array(); if( $talkable ) { diff --git a/includes/LogPage.php b/includes/LogPage.php index 864be5c20b..38f4fa2611 100644 --- a/includes/LogPage.php +++ b/includes/LogPage.php @@ -161,8 +161,11 @@ class LogPage { if( substr( $title->getText(), 0, 1 ) == '#' ) { $titleLink = $title->getText(); } else { - $titleLink = $skin->makeLinkObj( $title, $title->getText() ); - $titleLink .= ' (' . $skin->makeKnownLinkObj( SpecialPage::getTitleFor( 'Contributions', $title->getDBkey() ), wfMsg( 'contribslink' ) ) . ')'; + // TODO: Store the user identifier in the parameters + // to make this faster for future log entries + $id = User::idFromName( $title->getText() ); + $titleLink = $skin->userLink( $id, $title->getText() ) + . $skin->userToolLinks( $id, $title->getText(), false, Linker::TOOL_LINKS_NOBLOCK ); } break; case 'rights': diff --git a/includes/SpecialIpblocklist.php b/includes/SpecialIpblocklist.php index 61a941a2da..34c6dbdeab 100644 --- a/includes/SpecialIpblocklist.php +++ b/includes/SpecialIpblocklist.php @@ -283,8 +283,8 @@ class IPUnblockForm { if( $block->mAuto ) { $target = $block->getRedactedName(); # Hide the IP addresses of auto-blocks; privacy } else { - $target = $sk->makeLinkObj( Title::makeTitle( NS_USER, $block->mAddress ), $block->mAddress ); - $target .= ' (' . $sk->makeKnownLinkObj( SpecialPage::getSafeTitleFor( 'Contributions', $block->mAddress ), $msg['contribslink'] ) . ')'; + $target = $sk->userLink( $block->mUser, $block->mAddress ) + . $sk->userToolLinks( $block->mUser, $block->mAddress, false, Linker::TOOL_LINKS_NOBLOCK ); } $formattedTime = $wgLang->timeanddate( $block->mTimestamp, true ); diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index 41078260b3..a9c799a99c 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -2034,7 +2034,7 @@ to a previously blocked IP address or username.', 'contribslink' => 'contribs', 'autoblocker' => 'Autoblocked because your IP address has been recently used by "[[User:$1|$1]]". The reason given for $1\'s block is: "$2"', 'blocklogpage' => 'Block log', -'blocklogentry' => 'blocked "[[$1]]" with an expiry time of $2 $3', +'blocklogentry' => 'blocked [[$1]] with an expiry time of $2 $3', 'blocklogtext' => 'This is a log of user blocking and unblocking actions. Automatically blocked IP addresses are not listed. See the [[Special:Ipblocklist|IP block list]] for the list of currently operational bans and blocks.',